home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 764 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.iag.net!news
  2. From: jatmon@iag.net (John R Buchan)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: atoi
  5. Date: 9 Jan 1996 05:10:59 GMT
  6. Organization: Internet Access Group, Orlando, Florida
  7. Message-ID: <4cstd3$5a@news.iag.net>
  8. References: <4cl55i$5bc@news-e2a.gnn.com> <4cnko0$3u3@news.ais.net>
  9. NNTP-Posting-Host: pm1-orl16.iag.net
  10. X-Newsreader: WinVN 0.99.7
  11.  
  12. In article <4cnko0$3u3@news.ais.net>, joshez@ais.net says...
  13. >
  14. >
  15. >>i know its a dumb question but i really just dont understand
  16. >>this function.
  17. >
  18. >Follow this:
  19. >
  20. >int  number           ;
  21. >char string[4] = "123";
  22. >
  23. >...
  24. >...
  25. >...
  26. >
  27. >number = atoi(string);
  28. >
  29. >
  30. >String "123" is now integer that can be mathematicaly manipulated.
  31. >
  32. >That's all to it.
  33.  
  34. Wellll.. actually, "123" is still a string literal and string is still a
  35. char array, whose contents should be {'1', '2', '3', '\0'}.  However, the
  36. value of number should now be 123 (the value returned by atoi, barring any
  37. strange errors). :-)
  38.  
  39.  
  40.  
  41. -- 
  42. John R Buchan           -:|:-     Looking for that elusive FAQ?  ftp to:
  43. jatmon@mail.iag.net     -:|:-     rtfm.mit.edu /pub/usenet-by-group/....
  44.  
  45.